package com.andy.beef.main.api

import com.andy.beef.main.bean.CattleInfoBean
import com.andy.module.BASE_BREED
import com.andy.module.network.ApiPagerResponse
import com.andy.module.network.ApiResponse
import com.andy.module.network.RetrofitClient
import com.andy.module.network.SimpleApiService
import retrofit2.http.FieldMap
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST
import retrofit2.http.Url

/**
 * @creator:LuoFan
 * @date:2022/9/30
 * @description:
 */

//双重校验锁式-单例 封装NetApiService 方便直接快速调用简单的接口
val mainService: MainApiService by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
    RetrofitClient.getService(MainApiService::class.java, SimpleApiService.SERVER_URL)
}

interface MainApiService : SimpleApiService {

    companion object {

        //牛只列表
        const val URL_CATTLE_LIST = BASE_BREED + "mobile/cattle/list"

    }

    /**
     * 获取入场信息列表
     */
    @FormUrlEncoded
    @POST
    suspend fun getCattleList(
        @FieldMap params: HashMap<String, Any>, @Url url: String
    ): ApiResponse<ApiPagerResponse<CattleInfoBean>>

}